import {
	computed
} from 'vue'
import {
	request,
	retryableRequest
} from '@/common/request';
import {
	useUserStore
} from '@/stores/user.js'
const userType = computed(() => {
	return useUserStore().userType == 2 ? "b-agent-app/app" : "b-merchant-app/app"
})

export const merchantApi = {
	/**
	 * 分页查询商户
	 */
	page: (data) => {
		return request({
			url: `/${userType.value}/merchant/page`,
			data
		})
	},
	/**
	 * 分页查询商户-脱敏
	 */
	pageMask: (data) => {
		return request({
			url: `/${userType.value}/merchant/page_mask`,
			data
		})
	},

	/**
	 * 增加商户
	 */
	insert: (data) => {
		return request({
			url: `/${userType.value}/merchant/insert`,
			data
		})
	},

	/**
	 * 修改商户
	 */
	update: (data) => {
		return request({
			url: `/${userType.value}/merchant/update`,
			data
		})
	},

	/**
	 * 修改商户状态
	 */
	updateStatus: (data) => {
		return request({
			url: `/${userType.value}/merchant/update_status`,
			data
		})
	},

	/**
	 * 根据id查询商户
	 */
	findOne: (data) => {
		return request({
			url: `/${userType.value}/merchant/find_id`,
			data
		})
	},

	/**
	 * 重置密码
	 */
	resetPwd: (data) => {
		return request({
			url: `/${userType.value}/merchant/reset_pwd`,
			data
		})
	},

	/**
	 * 费率分页
	 */
	ratePage: (data) => {
		return request({
			url: `/${userType.value}/merchant/ratePage`,
			data
		})
	},

	/**
	 * 费率分页
	 */
	findRate: (data) => {
		return request({
			url: `/${userType.value}/merchant/findRate`,
			data
		})
	},
	// 业务员查商户列表
	exhibitionMerchantPage: (data) => {
		return request({
			url: `/${userType.value}/merchant/exhibition_page`,
			data
		})
	}
}